<?php
require_once($application_folder."/controllers/navigator.php");
class One_article extends navigator 
{

    function __construct()
    {
        parent::__construct(); 
    } 

    function index(){
        $c_url = explode('-',$_SERVER['REQUEST_URI']);
        $id = $c_url[count($c_url)-1];
        
        $this->getArticle($id);

    }

    function getArticle($id_article){

        $this->load->model('datam');
        $this->load->model('comments_mod');
        $this->load->helper('day_month');

        $res['columns'] = $this->datam->getColumns();
        $res['tickerNews'] = $this->datam->getArticlesColsSubcolsWithDefaultMediaByTags(1, '0,2');
        
        
        
        

        //$res['articles_politika'] = 
        //$res['articles_sevenday'] =  $this->datam->getArticlesColsSubcolsWithDefaultMediaByTags(1,'7,4');
        //$res['articles_today1'] =  $this->datam->getArticlesColsSubcolsWithDefaultMediaByTags(1,'5,6');
        $res['articles_today1'] =  $this->datam->getArticlesPastTime(1,6,1);
        $res['articles_sevenday'] =  $this->datam->getArticlesPastTime(1,4,7);
        $res['articles_top_comments'] =  $this->datam->getArticlesTopCommnets(1,6);
        
        $res['caricature'] =  $this->datam->getCaricature();
        $res['article'] = $this->datam->getArticleData($id_article);
        $res['article_media'] = $this->datam->getArticleMedia($id_article);
        $res['title'] = 'Dobrodosli';
        
		//Za scroller       
        //$res['articles_line'] = $this->datam->getArticlesColsSubcolsWithDefaultMedia();
        $res['articles_line'] = $this->datam->getArticlesForScroller($res['article']['cId'], $res['article']['sId']);
                
        $res['article_count_view'] = $this->datam->getSetCountArticleView($id_article);
        
        $res['comments'] = $this->comments_mod->getComments($id_article);

        $this->core_site('article', $res, 'home');

    }
}